package com.example.day16.ex07;

import java.util.ArrayList;
import java.util.Collections;

public class PokerDemo {
    public static void main(String[] args) {
        ArrayList<String> array=new ArrayList<>();
        String[]colors={"红桃","黑桃","梅花","方块"};
        String[]numbers={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
        for (String color : colors) {
            for (String number : numbers) {
                array.add(color+number);
            }
        }
        array.add("小王");
        array.add("大王");
        Collections.shuffle(array);
        ArrayList<String> array1=new ArrayList<>();
        ArrayList<String> array2=new ArrayList<>();
        ArrayList<String> array3=new ArrayList<>();
        ArrayList<String> array4=new ArrayList<>();
        for (int i = 0; i < array.size(); i++){
            String poker=array.get(i);
            if (i>=array.size()-3){
                array1.add(poker);
            }else if(i%3==0){
                array2.add(poker);
            }else if(i%3==1){
                array3.add(poker);
            }else if(i%3==2){
                array4.add(poker);
            }
        }
        lookPoker("zhang",array1);
        lookPoker("li",array2);
        lookPoker("wang",array3);
        lookPoker("zhao",array4);
    }
    public static void lookPoker(String name,ArrayList<String> array){
        System.out.println(name+"的牌是：");
        for (String poker : array) {
            System.out.println(poker+"");
        }
        System.out.println();
    }
}
